package com.example.utils;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

import com.example.BaseApp;
import com.example.config.AppConfig;

/**
 * Created by User on 2015/6/25.
 */
public class MySdliteDataBase extends SQLiteOpenHelper {
    public MySdliteDataBase() {
        super(BaseApp.getInstance(),AppConfig.DB_NAME, null, AppConfig.VERSION);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        db.execSQL("create table user_table (_id integer primary key,uid varchar(20),name varchar(20)) ");

    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {

        if(newVersion>oldVersion){
            db.execSQL("drop table if exists user_table");
            onCreate(db);
        }

    }
}
